package com.jy.controller;


import com.jy.common.enums.ResponseWrapper;
import com.jy.common.model.user.param.UserFollowerParam;
import com.jy.common.tool.CommonTool;
import com.jy.service.UserFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fzg
 * @since 2024-11-13
 */
@RestController
@RequestMapping("/user-follow")
public class UserFollowController {

    private final UserFollowService userFollowService;

    public UserFollowController(UserFollowService userFollowService) {
        this.userFollowService = userFollowService;
    }


    @GetMapping("/followerAuthor")
    public ResponseWrapper followerAuthor(HttpServletRequest request, @Validated UserFollowerParam param) {
        return userFollowService.followerAuthor(CommonTool.getUserAidByToken(request),param);
    };

    @GetMapping("/followerUser")
    public ResponseWrapper followerUser(HttpServletRequest request, @Validated @RequestParam Integer userAid) {
        return userFollowService.followerUser(CommonTool.getUserAidByToken(request),userAid);
    };

}
